package com.qianying.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * 客户材料实体类（优化版）
 * 通过customer_id与客户信息表关联，不直接存储客户名称
 */
@Data
@TableName("customer_material")
@Schema(description = "客户材料关联信息")
public class CustomerMaterial {

    @Schema(description = "主键ID", example = "1")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @Schema(description = "客户ID（关联customer_info表）", required = true, example = "1")
    @TableField("customer_id")
    private Long customerId;

    // 冗余字段，用于列表展示（非必须，可根据实际需求决定是否保留）
    @Schema(description = "客户名称（冗余字段，用于显示）", example = "斐乐")
    @TableField(exist = false)  // 表示数据库表中无此字段，仅用于查询结果展示
    private String customerName;

    @Schema(description = "材料表名称", required = true, example = "斐乐材料表")
    @TableField("material_table_name")
    private String materialTableName;

    @Schema(description = "访问路径", example = "http://domain.com/uploads/fila/20250803/xxx.xlsx")
    @TableField("access_path")
    private String accessPath;

    @Schema(description = "备注", example = "夏季材料清单")
    @TableField("remark")
    private String remark;

    @Schema(description = "创建时间", example = "2025-08-03 10:30:00")
    @TableField("create_time")
    private LocalDateTime createTime;

    @Schema(description = "更新时间", example = "2025-08-03 15:45:00")
    @TableField("update_time")
    private LocalDateTime updateTime;
}